package com.guanghua.brick.db;

import org.hibernate.SessionFactory;

import com.guanghua.brick.util.SpringBeanUtil;


/**
 * 使用spring整合hb3的hb sf实现
 * @author leeon
 */
public class SpringHBSessionFactory implements IHBSessionFactory {
	
	public static final String HB_SF_BEAN_ID = "sessionFactory";
	
	public SessionFactory getSessionFactory(String bean) throws Exception {
		if (bean == null) bean = HB_SF_BEAN_ID;
		
		SessionFactory sf = (SessionFactory)SpringBeanUtil.getBeanFactory().getBean(bean);
		return sf;
	}

}
